package de.ubschmidt.capi;

import java.nio.ByteBuffer;

/**
 * The purpose of the parameter B protocol is to select and configure the
 * B channel protocols. The parameter contains a protocol identifier
 * and configuration information for each layer.
 */
public class BProtocol
        implements ByteBufferWritable {

    private boolean _isSet = false;
    private B1Protocol _b1Protocol;

    /** Creates a new instance of BProtocol. */
    public BProtocol() {
    }

    public void clear() {
        _isSet = false;
        _b1Protocol = B1Protocol.HDLC_FRAMING_64KBITPS;
    }

    /** {@inheritDoc} */
    public void writeTo(final ByteBuffer byteBuffer) {
        byteBuffer.put((byte) 10);
        byteBuffer.putShort((short) 1);
        byteBuffer.putShort((short) 1);
        byteBuffer.putShort((short) 0);
        byteBuffer.put((byte) 0);
        byteBuffer.put((byte) 0);
        byteBuffer.put((byte) 0);
        byteBuffer.put((byte) 0);
    }

    @Override
    public String toString() {
        String s = String.format(
                "%s[...]",
                getClass().getSimpleName());

        return s;
    }

}
